<template>
  <div>
    <div
      class="car-type-box"
      v-for="(item, index) in carTypeListData.subjectList"
      :key="index"
    >
      <h4 class="type-title">
        <span class="left-line"></span>
        <span class="title">{{ item.title }}</span>
        <span class="get-more-sp">
          <span class="more-tab" v-for="(v, k) in item.data" :key="k">
            {{ v }}
          </span>
        </span>
      </h4>
      <div class="type-list flex content-box" >
        <div class="type-item">
          <img class="car-left-img" :src="item.pic|nopic" alt="" />
        </div>
        <div class="type-item" v-for="(val, key) in item.subjectProductVOList.slice(0, 4)" :key="key" @click="toDetail(val)">
          <img class="car-img" :src="val.pic|nopic" alt="" />
          <h4 class="car-name">{{ val.name }}</h4>
          <p class="car-des">{{ val.des }}</p>
          <p class="car-price">
            定向金 ￥<span class="price">{{ val.price }}</span>
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  props: ['carTypeListData'],
  methods:{
      toDetail(product){
          this.$router.push({path:'/ProductDetail',query: product})
      }
  },
};
</script>


<style lang="scss" scoped>
.car-type-box {
  margin: 40px 0;
  .type-title {
    width: 1190px;
    margin: 0 auto 26px;
    text-align: left;
    color: #333233;
    position: relative;
    .title {
      display: inline-block;
      vertical-align: middle;
    }
    .get-more-sp {
      font-weight: 400;
      font-size: 14px;
      line-height: 14px;
      color: #686868;
      position: absolute;
      right: 0;
      cursor: pointer;
      .more-tab {
        margin-left: 10px;
      }
    }
    .left-line {
      margin-right: 10px;
      display: inline-block;
      width: 6px;
      height: 22px;
      line-height: 24px;
      background-color: #fd686c;
      vertical-align: middle;
    }
  }
  .type-list {
    .type-item {
      width: 288px;
      height: 295px;
      background: #fff;
      margin-left: 13px;
      border-radius: 10px;
      overflow: hidden;
      cursor: pointer;
      .car-img {
        width: 100%;
        //height: 238px;
      }
      .car-left-img {
        width: 100%;
        //height: 100%;
      }
      .car-name {
        font-size: 18px;
        line-height: 18px;
        color: #2e2e2e;
        margin-top: 54px;
      }
      .car-des {
        font-size: 14px;
        line-height: 14px;
        color: #9e9e9e;
        margin-top: 8px;
      }
      .car-price {
        height: 16px;
        font-size: 14px;
        color: #cf2626;
        margin-top: 16px;
        .price {
          font-size: 20px;
          line-height: 20px;
        }
      }
    }
    .type-item:nth-child(1) {
      margin-left: 0;
    }
  }
}

/*手机端*/
@media (min-width: 320px) and (max-width: 800px) {
  .car-type-box{
    width: 100%;
    padding:0 10px;
    box-sizing: border-box; 
    margin: 20px 0;
    .type-title {
      width: 100%;
    }
    .type-list {
      width: 100%;
      flex-wrap: wrap;
      justify-content: space-between;
    }
    .type-item {
      width: 48% !important;
      height: 210px !important;
      margin-left: 0 !important;
      margin-bottom: 14px;
    }
    .car-img {
      //height: 110px !important;
      width: 100%;
    }
    .car-name {
      margin-top: 20px !important;
      font-size: 16px !important;
      white-space: nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      padding: 0 8px;
    }
    .car-des {
      white-space: nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      padding: 0 8px;
    }
  }
}
</style>